<template>
  <div class="warp" flex="dir:top box:first">
    <div>
      <div class="title">垃圾桶列表</div>

      <div class="list-thead">
        <table>
          <col width="15%" />
          <col width="15%" />
          <col width="50%" />
          <col width="20%" />
          <thead>
          <tr>
            <td>序号</td>
            <td>满溢度</td>
            <td>地址</td>
            <td>上报时间</td>
          </tr>
          </thead>
        </table>
      </div>
    </div>

    <ul class="list" v-if="dustbinList.length">
      <li v-for="(item,index) in dustbinList"
          :key="index"
          flex="dir:left">
        <div class="w-15">{{item.id}}</div>
        <div class="text-overflow w-15" :title="item.garbagePer">{{parseInt(item.garbagePer)}}%</div>
        <div class="w-50 text-overflow" :title="item.addr">{{item.addr}}</div>
        <div class="w-20 text-overflow" :title="item.reporttime">{{item.reporttime}}</div>
      </li>
    </ul>
    <div class="list-no" v-else>暂无数据</div>

  </div>
</template>
<script>
export default {
  props: ['deptId'],
  data () {
    return {
      dustbinList: []
    }
  },
  mounted () {
    this.init()
  },
  methods: {
    init: function () {
      let url = this.$base.getUrl('rosdustbininfo/selectAllDustbinInfo')
      let params = {
        url: url,
        data: {
          deptId: this.deptId
        }
      }
      this.$store.dispatch('getForm', params).then((res) => {
        this.dustbinList = res
      })
    }
  }
}
</script>
<style lang="less" scoped>
  .text-overflow{
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .warp {
    .title{
      color: #fff;
      font-size: 14px;
    }
    padding: 20px 15px;
    height: 100%;
    box-sizing: border-box;
  }

  .list-thead{
    margin-top: 15px;
    overflow-x: hidden;
    width: 100%;
    table {
      width: 100%;
      td {
        text-align: center;
      }
      thead {
        background-color: rgba(0, 0, 0, 0.2);
        width: 100%;
        height: 24px;
        line-height: 24px;
        font-size: 12px;
        color: #50E3C2;
        letter-spacing: 0.29px;
      }
    }
  }

  .list {
    margin-top: 10px;
    overflow-x: hidden;
    overflow-y: scroll;
    width: 100%;
    text-align: center;
    color: #9FACC3;
    li{
      width: 100%;
      height: 30px;
      line-height: 30px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
  }

  .list::-webkit-scrollbar {
    width: 0 !important
  }

  //chrome 和Safari
  .list {
    -ms-overflow-style: none;
  }

  //IE 10+
  .list {
    overflow: -moz-scrollbars-none;
  }

  .list-no {
    margin-top: 10px;
    text-align: center;
    color: #9FACC3;
  }

</style>
